LOG_DIR="/var"

echo "正在执行数据库迁移..."
python manage.py makemigrations
python manage.py migrate --no-input
echo "数据库迁移完成"

echo "正在启动服务..."
nohup gunicorn --workers=4 --threads=2 --bind=0.0.0.0:8000 demo.wsgi:application 2>&1 &
echo "服务启动完成"

echo "正在启动Celery任务..."
nohup celery -A celery_tasks.main worker --loglevel=INFO --logfile=${LOG_DIR}/celery.log 2>&1 &
echo "Celery任务启动完成"